import lazyLoad from "@/routers/utils/lazyLoad";
import { LayoutIndex } from "@/routers/constant";
import { RouteObject } from "@/routers/interface";
import { Navigate } from "react-router-dom";
import Login from "@/views/login/index";
import HomeRoute from "./modules/home";
import ErrorRoutes from "./modules/error";

// root
export const RootRoute: RouteObject = {
	path: "/",
	element: <Navigate to="/login" />
};

export const LoginRoute: RouteObject = {
	path: "/login",
	element: <Login />,
	meta: {
		requiresAuth: false,
		title: "Login Page",
		key: "login"
	}
};

export const BpmRoute: RouteObject = {
	path: "/bpm",
	element: <LayoutIndex />,
	children: [
		{
			path: "/bpm/manager/model/edit",
			element: lazyLoad(() => import("@/views/bpm/model/editor/index")),
			meta: {
				title: "design process"
			}
		}
	]
};

// 未经许可的基本路由
export const basicRoutes: RouteObject[] = [RootRoute, LoginRoute, BpmRoute, HomeRoute, ...ErrorRoutes];

export default basicRoutes;
